hysop.operator.misc module¶
- class hysop.operator.misc.ForceTopologyState(fields, variables, tstate=None, memorder=None, backend=None, extra_kwds=None, mpi_params=None, cl_env=None, **kwds)[source]¶
Bases:
Noop
Dummy operator used mostly for testing purposes where we need a consistant output topology and data layout (local transposition state, array backend, memory ordering).
This operator will just impose a given transposition states, a given memory ordering and a given backend, to all of its input fields. This forces the graph generator to generate additional operators and topologies to comply with those field requirements.
If transposition_state is not given, all input fields will be imposed to be in natural transposition order (YX in 2D and ZYX in 3D).
If memory_order is not given, all input fields will be imposed to be C_CONTIGUOUS.
If backend is not given, all input fields will be imposed to live on Backend.HOST.
- Parameters:
- input_discrete_fields¶
Dictionary containing continuous input fields as keys and discrete variables as values.
- Type:
- output_discrete_fields¶
Dictionary containing continuous output fields as keys and discrete variables as values.
- Type:
Notes
For the input and output fields, the keys of the dicts have to be of type
hysop.fields.continuous_field.Field
. and the values should consist ofhysop.topology.topology_descriptor.TopologyDescriptors
instances ie. an already defined topology or a topology descriptor.- The following base class variables cannot be specified in kwds
input_vars, output_vars, variables, rwork, iwork, work, backend.
Nothing besides __init__ should be called manually by the user as it should be embedded into a hysop.problem.Problem, or at least in some hysop.core.graph.computational_graph.ComputationalGraph derivative.
- get_field_requirements()[source]¶
Called just after handle_method(), ie self.method has been set. Field requirements are:
required local and global transposition state, if any.
required memory ordering (either C or Fortran)
Default is Backend.HOST, no min or max ghosts, MemoryOrdering.ANY and no specific default transposition state for each input and output variables.
- class hysop.operator.misc.Noop(input_fields=None, output_fields=None, **kwds)[source]¶
Bases:
ComputationalGraphOperator
An operator that does nothing and implements apply as noop.
- Parameters:
- input_discrete_fields¶
Dictionary containing continuous input fields as keys and discrete variables as values.
- Type:
- output_discrete_fields¶
Dictionary containing continuous output fields as keys and discrete variables as values.
- Type:
Notes
For the input and output fields, the keys of the dicts have to be of type
hysop.fields.continuous_field.Field
. and the values should consist ofhysop.topology.topology_descriptor.TopologyDescriptors
instances ie. an already defined topology or a topology descriptor.- The following base class variables cannot be specified in kwds
input_vars, output_vars, variables, rwork, iwork, work, backend.
Nothing besides __init__ should be called manually by the user as it should be embedded into a hysop.problem.Problem, or at least in some hysop.core.graph.computational_graph.ComputationalGraph derivative.
- apply(**kwds)¶
Abstract method that should be implemented. Applies this node (operator, computational graph operator…).
- get_node_requirements()[source]¶
Called after get_field_requirements to get global operator requirements.
- By default we enforce unique:
*transposition state *cartesian topology shape *memory order (either C or fortran)
Across every fields.
- classmethod supported_backends()[source]¶
Return the backends that this operator’s topologies can support as a set. By default all operators support only Backend.HOST.
- classmethod supports_mpi()[source]¶
Return True if this operator was implemented to support multiple mpi processes.
- classmethod supports_multiple_field_topologies()[source]¶
Should return True if an input field that is also an output field can have an input topology different from its output topology. This is usefull in Redistribute like operators. If this returns True this implies supports_multiple_topologies(). It also implies that self.variables[field] may return a set of topologies. In this case one can recover input and output topologies by using self.input_fields[field] and self.output_fields[field]. In addition one can find such fields by using the list self.multi_topo_fields which is set after ComputationalGraphNode.initialize() has been called.